package com.atguigu.rabbitmq.six;

import com.atguigu.rabbitmq.utils.RabbitMqutils;
import com.rabbitmq.client.Channel;

import java.io.IOException;
import java.util.Scanner;
import java.util.concurrent.TimeoutException;

public class DirectLogs {


    //交换机的名字
    public static final String EXCHANGE_NAME = "direct_logs";

    public static void main(String[] args) throws IOException, TimeoutException {
        Channel channel = RabbitMqutils.getChannel();
        //交互机
        // channel.exchangeDeclare(EXCHANGE_NAME,"fauout");
        Scanner scanner = new Scanner(System.in);

        while (scanner.hasNext()) {
            String message = scanner.next();
           // channel.basicPublish(EXCHANGE_NAME, "error", null, message.getBytes("utf-8"));
          //  channel.basicPublish(EXCHANGE_NAME, "info", null, message.getBytes("utf-8"));
            channel.basicPublish(EXCHANGE_NAME, "warning", null, message.getBytes("utf-8"));

            System.out.println("生产者发出的消息是什么" + message);
        }
    }
}